#!/bin/bash
export LANG=zh_CN.UTF-8
PRESTO_HOME=/export/server/presto/bin/presto
MYSQL_HOME=/usr/bin/mysql

${MYSQL_HOME} -h192.168.88.80 -p3306 -uroot -p123456 -e "
CREATE DATABASE IF NOT EXISTS edu_rpt DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
use edu_check;
drop table if exists edu_rpt.hcx_rpt_day_cnt;
drop table if exists edu_rpt.hcx_rpt_month_area_cnt;
drop table if exists edu_rpt.hcx_rpt_month_chat_area_cnt;
drop table if exists edu_rpt.kxh_rpt_year_school_cnt_top;
drop table if exists edu_rpt.hcx_rpt_year_sum_clue;"

${PRESTO_HOME} --catalog hive --server 192.168.88.80:8090 --execute

"    create table mysql.edu_rpt.hcx_rpt_day_cnt
    as
    select * from  hive.edu_rpt.hcx_rpt_day_cnt;

    create table mysql.edu_rpt.hcx_rpt_month_area_cnt
    as
    select * from hive.edu_rpt.hcx_rpt_month_area_cnt;

    create table mysql.edu_rpt.hcx_rpt_month_chat_area_cnt
    as
    select * from hive.edu_rpt.hcx_rpt_month_chat_area_cnt;

    create table mysql.edu_rpt.kxh_rpt_year_school_cnt_top
    as
    select * from hive.edu_rpt.kxh_rpt_year_school_cnt_top;

    create table mysql.edu_rpt.hcx_rpt_year_sum_clue
    as
    select * from hive.edu_rpt.hcx_rpt_year_sum_clue;

"
